home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 67 / IOPROG_67A.ISO / soft / Tools / mwsppv4.exe / CVS SOURCE CONTROL.SCRIPT < prev    next >
Encoding:
Text File  |  2001-10-24  |  11.5 KB  |  246 lines

  1. !!Script
  2.  
  3. // Copyright ⌐ 2001 - Hendrik Witt [2001-10-20.17-42-47;hwitt@tzi.de]
  4. // @Creaded build 090 [2001-10-20.17-42-52;hwitt@tzi.de]
  5.  
  6.  
  7. /**
  8. @Tool: CVS Source Control~defines the Source Control toolbar for CVS systems. This
  9. toolbar uses the sourceControl property set in the project to 
  10. determine which source control database is used.
  11. @EndTool: 
  12. @Summary: CVS Source Control~defines the CVS Source Control toolbar
  13. */
  14.  
  15. var gOutput = getOutput();
  16.  
  17. function OnNotify(event, cookie)
  18. {
  19.     var toolbar = getGlobal("CVSToolbar");
  20.     if (event == "project.changed")
  21.     {
  22.         if (toolbar)
  23.         {
  24.             var activate = false;
  25.             var configure = false;
  26.             var project = getCurrentProject();
  27.             if (project)
  28.             {
  29.                 activate = project.sourceControl.length > 0;
  30.                 
  31.                 if (activate)
  32.                 {
  33.                     var currentPath = getGlobal("CVSToolbar.ScriptPath");
  34.                     var newPath = "Source Control\\" + project.sourceControl + "\\";
  35.                     if (currentPath != newPath)
  36.                     {
  37.                         setGlobal("CVSToolbar.ScriptPath", newPath);
  38.                         UpdateToolBar(toolbar, newPath);
  39.                     }
  40.                     
  41.                     var configurePath = File.getToolsPath() + "\\" + newPath + "configure.dscript";
  42.                     configure = pathExists(configurePath);              
  43.                     
  44.                 }
  45.             }
  46.  
  47.             toolbar.enableButton(getGlobal("CVSToolbar.LogonID"), activate);
  48.             toolbar.enableButton(getGlobal("CVSToolbar.CheckoutID"), activate);
  49.             toolbar.enableButton(getGlobal("CVSToolbar.EditID"), activate);
  50.             toolbar.enableButton(getGlobal("CVSToolbar.UneditID"), activate);
  51.             toolbar.enableButton(getGlobal("CVSToolbar.UpdateID"), activate);
  52.             toolbar.enableButton(getGlobal("CVSToolbar.StatusID"), activate);
  53.             toolbar.enableButton(getGlobal("CVSToolbar.CommitID"), activate);
  54.             toolbar.enableButton(getGlobal("CVSToolbar.LogID"), activate);
  55.             toolbar.enableButton(getGlobal("CVSToolbar.DiffID"), activate);
  56.             toolbar.enableButton(getGlobal("CVSToolbar.AddID"), activate);
  57.             toolbar.enableButton(getGlobal("CVSToolbar.ImportID"), activate);
  58.             toolbar.enableButton(getGlobal("CVSToolbar.CustomID"), activate);
  59.         }
  60.     }
  61.     else if (cookie == toolbar && event == "toolbar.show")
  62.     {
  63.         var project = getCurrentProject();
  64.         if (project && project.sourceControl.length == 0)
  65.         {
  66.             alert("To activate the source control toolbar choose a\nsource control database using the Project menu's Add Package\nor Edit Package commands");
  67.         }
  68.         else if (project == null)
  69.         {
  70.             alert("To activate the source control toolbar create or\nopen a project and choose a source control database\nusing the Add Package or Edit Package commands");
  71.         }
  72.     }
  73. }
  74.  
  75. function DoCommand() 
  76. {
  77.     var toolbar = newToolBar("CVS Source Control", "docked");
  78.     setGlobal("CVSToolbar", toolbar);
  79.     Application.registerNotify(getScriptPath(), "project.changed"); // call OnNotify when a project is changed
  80.     Application.registerNotify(getScriptPath(), "toolbar.show"); // call OnNotify when toolbar.show is called
  81.     
  82.     var ssPath = "Source Control\\CVS Advanced\\"; // initial source control
  83.     setGlobal("CVSToolbar.ScriptPath", ssPath);
  84.     
  85.     
  86.     //Logon button
  87.     var buttonLogon = newToolBarButton("icon");
  88.     buttonLogon.scriptPath = ssPath + "logon.script";
  89.     buttonLogon.imagePath = "Toolbars\\Images\\CVS\\logon.bmp"; 
  90.     buttonLogon.description = "Logon to the CVS source control system";
  91.     buttonLogon.toolTipText = "Logon";
  92.     var LogonID = toolbar.setButton(0, buttonLogon);
  93.     
  94.     //checkout button
  95.     var buttonCheckout = newToolBarButton("icon");
  96.     buttonCheckout.scriptPath = ssPath + "checkout.script";
  97.     buttonCheckout.imagePath = "Toolbars\\Images\\CVS\\checkout.bmp"; 
  98.     buttonCheckout.description = "Checkout a file/project from the CVS source control system";
  99.     buttonCheckout.toolTipText = "Checkout";
  100.     var CheckoutID = toolbar.setButton(1, buttonCheckout);
  101.     
  102.     //edit button
  103.     var buttonEdit = newToolBarButton("icon");
  104.     buttonEdit.scriptPath = ssPath + "edit.script";
  105.     buttonEdit.imagePath = "Toolbars\\Images\\CVS\\edit.bmp"; 
  106.     buttonEdit.description = "Remove the read-only flag for editing the source";
  107.     buttonEdit.toolTipText = "Edit";
  108.     var EditID = toolbar.setButton(2, buttonEdit);
  109.     
  110.     //unedit button
  111.     var buttonUnedit = newToolBarButton("icon");
  112.     buttonUnedit.scriptPath = ssPath + "unedit.script";
  113.     buttonUnedit.imagePath = "Toolbars\\Images\\CVS\\unedit.bmp"; 
  114.     buttonUnedit.description = "Unedit the current changes and track back to old version";
  115.     buttonUnedit.toolTipText = "Unedit";
  116.     var UneditID = toolbar.setButton(3, buttonUnedit);
  117.     
  118.     //update buttom
  119.     var buttonUpdate = newToolBarButton("icon");
  120.     buttonUpdate.scriptPath = ssPath + "update.script";
  121.     buttonUpdate.imagePath = "Toolbars\\Images\\CVS\\update.bmp"; 
  122.     buttonUpdate.description = "Updates the current version to get the newest from server";
  123.     buttonUpdate.toolTipText = "Update";
  124.     var UpdateID = toolbar.setButton(4, buttonUpdate);
  125.     
  126.     //status button
  127.     var buttonStatus = newToolBarButton("icon");
  128.     buttonStatus.scriptPath = ssPath + "status.script";
  129.     buttonStatus.imagePath = "Toolbars\\Images\\CVS\\status.bmp"; 
  130.     buttonStatus.description = "Get the status of the CVS source control system";
  131.     buttonStatus.toolTipText = "Status";
  132.     var StatusID = toolbar.setButton(5, buttonStatus);
  133.  
  134.     //log button 
  135.     var buttonLog = newToolBarButton("icon");
  136.     buttonLog.scriptPath = ssPath + "log.script";
  137.     buttonLog.imagePath = "Toolbars\\Images\\CVS\\log.bmp"; 
  138.     buttonLog.description = "Displays the logging information";
  139.     buttonLog.toolTipText = "Log";
  140.     var LogID = toolbar.setButton(6, buttonLog);
  141.     
  142.     //diff button
  143.     var buttonDiff = newToolBarButton("icon");
  144.     buttonDiff.scriptPath = ssPath + "diff.script";
  145.     buttonDiff.imagePath = "Toolbars\\Images\\CVS\\diff.bmp"; 
  146.     buttonDiff.description = "Displays the difference betwenn to versions";
  147.     buttonDiff.toolTipText = "Diff";
  148.     var DiffID = toolbar.setButton(7, buttonDiff);
  149.  
  150.     //commit button
  151.     var buttonCommit = newToolBarButton("icon");
  152.     buttonCommit.scriptPath = ssPath + "commit.script";
  153.     buttonCommit.imagePath = "Toolbars\\Images\\CVS\\commit.bmp"; 
  154.     buttonCommit.description = "Creates a new version on the CVS server (new release)";
  155.     buttonCommit.toolTipText = "Commit";
  156.     var CommitID = toolbar.setButton(8, buttonCommit);
  157.     
  158.     //add button
  159.     var buttonAdd = newToolBarButton("icon");
  160.     buttonAdd.scriptPath = ssPath + "add.script";
  161.     buttonAdd.imagePath = "Toolbars\\Images\\CVS\\add.bmp"; 
  162.     buttonAdd.description = "Add a new file to the CVS repository";
  163.     buttonAdd.toolTipText = "Add";
  164.     var AddID = toolbar.setButton(9, buttonAdd);
  165.     
  166.     //import button 
  167.     var buttonImport = newToolBarButton("icon");
  168.     buttonImport.scriptPath = ssPath + "import.script";
  169.     buttonImport.imagePath = "Toolbars\\Images\\CVS\\module.bmp"; 
  170.     buttonImport.description = "Import a new project/module to the CVS repository";
  171.     buttonImport.toolTipText = "Import";
  172.     var ImportID = toolbar.setButton(10, buttonImport);
  173.     
  174.     //custom command button
  175.     var buttonCustom = newToolBarButton("icon");
  176.     buttonCustom.scriptPath = ssPath + "customCommand.script";
  177.     buttonCustom.imagePath = "Toolbars\\Images\\CVS\\exe.bmp"; 
  178.     buttonCustom.description = "Executes a custom CVS command";
  179.     buttonCustom.toolTipText = "Custom Command";
  180.     var CustomID = toolbar.setButton(11, buttonCustom);
  181.    
  182.     
  183.     
  184.     
  185.     setGlobal("CVSToolbar.LogonID", LogonID);
  186.     setGlobal("CVSToolbar.CheckoutID", CheckoutID);
  187.     setGlobal("CVSToolbar.EditID", EditID);
  188.     setGlobal("CVSToolbar.UneditID", UneditID);
  189.     setGlobal("CVSToolbar.UpdateID",UpdateID);
  190.     setGlobal("CVSToolbar.StatusID", StatusID);
  191.     setGlobal("CVSToolbar.CommitID", CommitID);
  192.     setGlobal("CVSToolbar.LogID", LogID);
  193.     setGlobal("CVSToolbar.DiffID", DiffID);
  194.     setGlobal("CVSToolbar.AddID", AddID);
  195.     setGlobal("CVSToolbar.ImportID", ImportID);
  196.     setGlobal("CVSToolbar.CustomID", CustomID);
  197.     
  198.     toolbar.enableButton(getGlobal("CVSToolbar.LogonID"), false);
  199.     toolbar.enableButton(getGlobal("CVSToolbar.CheckoutID"), false);
  200.     toolbar.enableButton(getGlobal("CVSToolbar.EditID"), false);
  201.     toolbar.enableButton(getGlobal("CVSToolbar.UneditID"), false);
  202.     toolbar.enableButton(getGlobal("CVSToolbar.UpdateID"), false);
  203.     toolbar.enableButton(getGlobal("CVSToolbar.StatusID"), false);
  204.     toolbar.enableButton(getGlobal("CVSToolbar.CommitID"), false);
  205.     toolbar.enableButton(getGlobal("CVSToolbar.LogID"), false);
  206.     toolbar.enableButton(getGlobal("CVSToolbar.DiffID"), false);
  207.     toolbar.enableButton(getGlobal("CVSToolbar.AddID"), false);
  208.     toolbar.enableButton(getGlobal("CVSToolbar.ImportID"), false);
  209.     toolbar.enableButton(getGlobal("CVSToolbar.CustomID"), false);
  210.     
  211.     toolbar.restoreState();
  212. }
  213.  
  214. function UpdateToolBar(toolbar, ssPath)
  215. {       
  216.     var LogonID     = toolbar.setButton(0, ssPath + "logon.script", "Logon to the CVS source control system", "Logon");
  217.     var CheckoutID  = toolbar.setButton(1, ssPath + "checkout.script", "Get a file/project from the CVS source control system", "Checkout");
  218.     var EditID      = toolbar.setButton(2, ssPath + "edit.script", "Remove the read-only flag for editing the source", "Edit");
  219.     var UneditID    = toolbar.setButton(3, ssPath + "unedit.script", "Unedit the current changes and track back to old version", "Unedit");
  220.     var UpdateID    = toolbar.setButton(4, ssPath + "update.script", "Updates the current version to get the newest from server", "Update");
  221.     var StatusID    = toolbar.setButton(5, ssPath + "status.script", "Get the status of the source control system", "Status");
  222.     var CommitID    = toolbar.setButton(8, ssPath + "commit.script", "Creates a new version on the CVS server (new release)", "Commit");
  223.     var LogID       = toolbar.setButton(6, ssPath + "log.script", "Displays the logging information", "Log");
  224.     var DiffID      = toolbar.setButton(7, ssPath + "diff.script", "Displays the difference betwenn to versions", "Diff");
  225.     var AddID       = toolbar.setButton(9, ssPath + "add.script", "Add a new file to the CVS repository", "Add");
  226.     var ImportID    = toolbar.setButton(10, ssPath + "import.script", "Import a new project/module to the CVS repository", "Import");
  227.     var CustomID    = toolbar.setButton(11, ssPath + "customCommand.script", "Executes a custom CVS command", "Custom command");
  228.     
  229.     setGlobal("CVSToolbar.LogonID", LogonID);
  230.     setGlobal("CVSToolbar.CheckoutID", CheckoutID);
  231.     setGlobal("CVSToolbar.EditID", EditID);
  232.     setGlobal("CVSToolbar.UneditID", UneditID);
  233.     setGlobal("CVSToolbar.UpdateID",UpdateID);
  234.     setGlobal("CVSToolbar.StatusID", StatusID);
  235.     setGlobal("CVSToolbar.CommitID", CommitID);
  236.     setGlobal("CVSToolbar.LogID", LogID);
  237.     setGlobal("CVSToolbar.DiffID", DiffID);
  238.     setGlobal("CVSToolbar.AddID", AddID);
  239.     setGlobal("CVSToolbar.ImportID", ImportID);
  240.     setGlobal("CVSToolbar.CustomID", CustomID);
  241. }
  242.  
  243.  
  244. !!/Script
  245.  
  246.